<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:oo="http://openfaces.org/">
    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
    <style type="text/css">@import url("css/calendar-estilo.css");</style>
    <script type="text/javascript" src="js/calendar.js" />
    <script type="text/javascript" src="js/calendar-es.js" />
    <script type="text/javascript" src="js/calendar-setup.js" />


    <script type="text/javascript">
        window.onload = function() {
            Calendar.setup({
                inputField: "fecha",
                ifFormat:   "%d / %m / %Y",
                button:     "selector"
            });
        }
    </script>
    <ui:composition template="/WEB-INF/templates/principal.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.CreatePedidoTitle}"></h:outputText>
        </ui:define>
        <ui:define name="content">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>


                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.CreatePedidoLabel_id}" for="id" />
                    <h:inputText id="id" value="#{pedidoController.selected.id}" title="#{bundle.CreatePedidoTitle_id}" required="true" requiredMessage="#{bundle.CreatePedidoRequiredMessage_id}"/>
                    <h:outputLabel value="#{bundle.CreatePedidoLabel_fecha}" for="fecha" />

                    <h:inputText id="fecha" value="#{pedidoController.selected.fecha}" title="#{bundle.CreatePedidoTitle_fecha}" required="true" requiredMessage="#{bundle.CreatePedidoRequiredMessage_fecha}">
                        <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                    </h:inputText>
                    <h:outputLabel value="#{bundle.CreatePedidoLabel_total}" for="total" />
                    <h:inputText id="total" value="#{pedidoController.selected.total}" title="#{bundle.CreatePedidoTitle_total}" required="true" requiredMessage="#{bundle.CreatePedidoRequiredMessage_total}"/>

                    <h:outputLabel value="#{bundle.CreatePedidoLabel_estadoId}" for="estadoId" />
                    <h:selectOneMenu id="estadoId" value="#{pedidoController.selected.estadoId}" title="#{bundle.CreatePedidoTitle_estadoId}" required="true" requiredMessage="#{bundle.CreatePedidoRequiredMessage_estadoId}">
                        <f:selectItems value="#{estadoController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>

                    <h:outputLabel value="#{bundle.CreatePedidoLabel_clienteId}" for="clienteId" />
                    <h:selectOneMenu id="clienteId" value="#{pedidoController.selected.clienteId}" title="#{bundle.CreatePedidoTitle_clienteId}" required="true" requiredMessage="#{bundle.CreatePedidoRequiredMessage_clienteId}">
                        <f:selectItems value="#{clienteController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>

                </h:panelGrid>
                <br />
                <h:commandLink action="#{pedidoController.create}" value="#{bundle.CreatePedidoSaveLink}" />
                <br />
                <br />
                <h:commandLink action="#{pedidoController.prepareList}" value="#{bundle.CreatePedidoShowAllLink}" immediate="true"/>
                <br />
                <br />
                <h:commandLink value="#{bundle.CreatePedidoIndexLink}" action="/index" immediate="true" />

            </h:form>


        </ui:define>
    </ui:composition>

</html>
